package com.hmall.common.Interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * @Description MyFeignInterceptor
 * @Author GGBond
 * @Date 2024-11-16
 */
public class MyFeignInterceptor implements RequestInterceptor {

    /**
     * Feign的拦截器RequestInterceptor
     * @param requestTemplate
     */
    @Override
    public void apply(RequestTemplate requestTemplate) {
        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();

        requestTemplate.header("2");
    }
}
